<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 传统写法
        const p = new Promise((resolve, reject) => {
            resolve('调用成功');
            // reject('调用失败');
        });
        p.then((successMessage)=>{
            console.log(successMessage);
        })

        // Promise.resolve()：是成功态Promise的简写形式
        const p2 = Promise.resolve('调用成功');
        p2.then((successMessage)=>{
            console.log(successMessage);
        })

        // Promise.reject()：是失败态的Promise的简写形式
        const p3 = Promise.reject('调用失败');
        p3.catch((err)=>{
            console.log(err);
        })
    </script>
</body>

</html>